package cn.hanyx.coder.design.pattern.behavioral.iterator.demo01;

import java.util.ArrayList;

/**
 * Demo
 *
 * @author hanyx
 * @date 2020/06/10
 */
public class Demo {
    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        list.add("hello");
        list.add("world");
        list.add("java");
        list.add("spring");
        list.iterator();

        Iterator<String> ite = new ArrayIterator<>(list);
        while (ite.hasNext()) {
            System.out.println(ite.currentItem());
            ite.next();
            list.remove("world");
        }
    }
}
